package edu.ssdut.revise.models;

import com.github.javaparser.Range;
import com.github.javaparser.ast.Node;


/**
 * a base node can be extended by other nodes, but the specific function accessibility is
 * up to the interfaces the subclasses implements
 */
public class VisBaseNode implements VisWithTypeName {
    private String comment;  //only the comment one line above (LineComment of JavadocComment)
    private Range range;

    public Range getRange() {
        return range;
    }

    public String getComment() {
        return comment;
    }

    @Override
    public String getTypeName() {
        return "BaseNode";
    }

    public VisBaseNode(Object o) {
        if (o instanceof Node) {
            Node node = (Node) o;
            this.comment = node.getComment().isPresent() ? node.getComment().get().toString() : "";
            if (node.getRange().isPresent()) {
                this.range = node.getRange().get();
            }
        }
    }
}
